const express = require('express')
const router = express.Router()
const asyncHandler = require('../util/asyncHandler')
const request = require('request')
const fs = require('fs')
const multer = require('multer')

router.post(
    '/upload',
    multer({ dest: './server/ztest' }).single('file'),
    (req, res) => {
        console.log(req.file)
        fs.renameSync(req.file.path, `./server/ztest/${req.file.originalname}`)
        res.send(req.file)
    }
)

module.exports = router
